package api

import (
	"course/api/handler"
	"course/api/mibbile"
	"course/consts"
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
)

func Video(r *gin.Engine) {
	api := r.Group("./api")
	r.Use(mibbile.GetUinApp())
	{
		user := api.Group("/user")
		{
			user.POST("/register", handler.Register)
			user.POST("/login", handler.Login)
			user.POST("/find", handler.FindUser)
		}
		video := api.Group("/video")
		{
			video.POST("/create", handler.CreateVideo)
			video.POST("/creates", handler.CreateComment)
			video.POST("/list", handler.ListVideo)
			video.POST("/update", handler.UpdateVideo)
			video.POST("/del", handler.DelVideo)
			video.POST("/info", handler.InfoVideo)
		}
		chat := api.Group("/chat")
		chat.Use(jwt.JWTAuth(consts.JWT_KEY))
		{
			chat.GET("/chats", handler.Chat)
		}
		cour := api.Group("/course")
		{
			cour.GET("/list", handler.ListCourse)
		}
	}
}
